package cn.yunhe.exportExcel;

import cn.yunhe.entity.PayBack;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author MSJ
 * @date 2018/9/19 19:54
 * 导入excel bean数据工具类
 */
public class ExcelBeanUtil {
    /**
     * 处理产品列表 塞入list-map 等待塞入excel的workbook进行处理
     *
     * @param products
     * @return
     */
    public static List<Map<Integer, Object>> manageProductList(final List<PayBack> products) {
        List<Map<Integer, Object>> dataList = new ArrayList<>();
        if (products != null && products.size() > 0) {
            int length = products.size();

            Map<Integer, Object> dataMap;
            PayBack bean;
            for (int i = 0; i < length; i++) {
                bean = products.get(i);
                // String[] headers = new String[]{ "赔案编号", "案件编号","保单编号", "收款人","身份证号", "联系方式","车牌号", "信用卡",  "赔付金额", "赔付日期", "业务员"};
                dataMap = new HashMap<>();
                dataMap.put(0, bean.getPaySerial());
                dataMap.put(1, bean.getCases().getCaseUuid());
                dataMap.put(2, bean.getCases().getOrder().getOid());
                dataMap.put(3, bean.getPayName());
                dataMap.put(4, bean.getUserCardId());
                dataMap.put(5, bean.getUserPhone());
                dataMap.put(6, bean.getLicenseNum());
                dataMap.put(7, bean.getCreditCard());
                dataMap.put(8, bean.getPayMoney());
                dataMap.put(9, bean.getPayDate());
                dataMap.put(10,bean.getEmp().getEmpName());
                dataList.add(dataMap);
            }
        }
        return dataList;
    }
}
